import { ExclamationCircleOutlined } from '@ant-design/icons'
import { Modal } from 'antd'
interface MallModalProps {
  title: string //标题
  content?: string //内容
  okText?: string //ok按钮标题
  cancelText?: string //取消按钮标题
  onOk?: (...args: any[]) => any //确认按钮
  onCancel?: (...args: any[]) => any //取消按钮
}

/**
 * 对话框
 * @param {MallModalProps} props
 * @constructor
 * @return React.ReactNode
 */
const MallModal = (props: MallModalProps) => {
  const {
    title,
    content,
    okText,
    cancelText,
    onOk,
    onCancel
  } = props
  return Modal.confirm({
    title,
    icon: <ExclamationCircleOutlined />,
    content,
    okText: okText ? okText : '确认',
    cancelText: cancelText ? cancelText : '取消',
    onOk,
    onCancel
  })
}
export default MallModal
